package com.ynunicom.dc.dingdingcontractapp.configuration.schedule.skipschedule;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author: jinye.Bai
 * @date: 2020/6/9 10:44
 */
public class ContractSkipScheduleCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        String enable = conditionContext.getEnvironment().getProperty("skip.enable");
        if (enable==null|| "".equals(enable)){
            return true;
        }
        return Boolean.parseBoolean(enable);
    }
}
